package test;

import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;

public class FileUtils {
	public static Iterable<String> readlines(String filename)
			throws IOException {
		final FileReader fr = new FileReader(filename);
		final BufferedReader br = new BufferedReader(fr);

		return new Iterable<String>() {
			public Iterator<String> iterator() {
				return new Iterator<String>() {
					public boolean hasNext() {
						return line != null;
					}

					public String next() {
						String retval = line;
						line = getLine();
						return retval;
					}

					public void remove() {
						throw new UnsupportedOperationException();
					}

					String getLine() {
						String line = null;
						try {
							line = br.readLine();
						} catch (IOException ioEx) {
							line = null;
						}
						return line;
					}

					String line = getLine();
				};
			}
		};
	}

	public static void main(String[] args) throws Exception {
		TimeUnit tu = TimeUnit.MICROSECONDS;
		System.out.println(tu.toNanos(1));
		System.out.println("12Сʱ" + (tu.convert(12, TimeUnit.HOURS))
				+ tu.name());
		/*
		 * for (String line : FileUtils.readlines(args[0]))
		 * System.out.println(line);
		 */
	}
}
